const state = {
  // Boolean()是判断变量是true还是false 不是将字符串'false' 转为 布尔的false
  isCollapse: sessionStorage.getItem('isCollapse') ? JSON.parse(sessionStorage.getItem('isCollapse')) : false,
  activeItem: sessionStorage.getItem('currentPath') || '/console'
}
const mutations = {
  setCollapse (state) {
    state.isCollapse = !state.isCollapse
    sessionStorage.setItem('isCollapse', state.isCollapse + '')
  },
  setActiveItem (state, path) {
    sessionStorage.setItem('currentPath', path)
    state.activeItem = path
  }
}

export default {
  namespaced: true,
  state,
  mutations
}
